package com.atguigu.spzx.manager.service.impl;

import com.atguigu.spzx.manager.mapper.SysRoleMenuMapper;
import com.atguigu.spzx.manager.service.SysRoleMenuService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SysRoleMenuServiceImpl implements SysRoleMenuService {
    @Resource
    SysRoleMenuMapper sysRoleMenuMapper;
    @Override
    public void assignMenus(Long roleId, List<Long> menuIds) {
        //1、删除该角色之前拥有的菜单
        sysRoleMenuMapper.deleteMenusByRoleId(roleId);
        //2、将本次提交的菜单分配给角色
        sysRoleMenuMapper.assignMenus2Role(roleId , menuIds);
    }
}
